<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@taglib prefix="lb" uri="http://www.itlaobing.cn/tags" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<title>账号管理</title>
<js>
<script src="${ctx}/assets/app/js/management/systemAccounts.js"></script>
</js>
<div class="row no-gutter">
	<div class="col-md-12">
		<div class="panel panel-default">
			<div class="panel-heading">
				<h4>用户列表</h4>
				<ul class="links">
					<li>
						<a href="${ctx}/systemAccounts/create" title="新建账号">
							<i class="fa fa-plus"></i> 新建账号
						</a>
					</li>
				</ul>
			</div>
			<div class="panel-body">
				<div class="row">
					<form id="searchable" class="form-horizontal" action="${ctx}/systemAccounts" method="get">
						<div class="col-xs-3">
							<input id="account" name="account" class="form-control" placeholder="账号，真实姓名" type="text" value="${param.account}"/>
						</div>
						<div class="col-xs-3">
							<button type="submit" class="btn btn-sm btn-success">
								查询
								<span class="ace-icon fa fa-search icon-on-right bigger-110"></span></button>
						</div>
					</form>
				</div>
				<br />
				<table class="table table-bordered table-hover">
					<tr>
						<td>账号</td>
						<td>真实姓名</td>
						<td>是否锁定</td>
						<td>角色</td>
						<td>上次登录时间</td>
						<td>创建时间</td>
						<td>操作</td>
					</tr>
					<c:forEach var="account" items="${accounts}">
						<c:if test="${account.status==1}">
							<tr class="${account.locked?'warning':''}">
								<td>${account.account}</td>
								<td>${account.realName}</td>
								<td class="isLock">
									<c:if test="${account.locked}">
										<span class="label label-danger">已锁定 <i class="ace-icon fa fa-lock"></i> </span>
									</c:if>
									<c:if test="${!account.locked}">
										<span class="label label-success">未锁定 <i class="ace-icon fa fa-unlock"></i> </span>
									</c:if>
								</td>
								<td id="role-13">
									<span class='label  label-info label-white middle'>${account.status==0?'超级管理员':'普通管理员'}</span>
								</td>
								<td>
									<fmt:formatDate value="${account.lastLoginAt }" pattern="yyyy-MM-dd HH:mm"/>
								</td>
								<td>
									<fmt:formatDate value="${account.createAt }" pattern="yyyy-MM-dd HH:mm"/>
								</td>
								<td>
									<div class="btn-group">
										<a class="btn btn-sm btn-info btn-resetPassword"
											data-url="/systemAccounts/${account.id}/resetPassowrd">重置密码</a>
									<c:if test="${account.locked}">
										<a class="btn btn-lock btn-sm btn-success" data-url="/systemAccounts/${account.id}/lock">解锁</a>
									</c:if>
									<c:if test="${!account.locked}">
										<a class="btn btn-lock btn-sm btn-danger" data-url="/systemAccounts/${account.id}/lock">锁定</a>
									</c:if>
											
									</div>
								</td>
							</tr>
						</c:if>
					</c:forEach>
				</table>
			</div>
		</div>
		<lb:pagination pager="${accounts}"/>
	</div>
</div>